/*
 * Copyright (C) 2025 ameise <ameise.wang@gmail.com> - All Rights Reserved
 *
 * This file is part of e3lock.
 *
 * e3lock is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * e3lock is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with e3lock. If not, see <https://www.gnu.org/licenses/>.
 */

package e3lock

const (
	unlocked = iota
	locked
)

const (
	layout      = "MST 2006-01-02 15:04:05.000"
	logFormat   = "%s | %v | %v\n"
	traceFormat = "TRAC"
	warnFormat  = "WARN"
)

const (
	scriptUnlock = `
	if redis.call("GET", KEYS[1]) == ARGV[1] then
		return redis.call("DEL", KEYS[1])
	else
		return 0
	end
	`

	scriptWatch = `
	if redis.call("GET", KEYS[1]) == ARGV[1] then
		return redis.call("PEXPIRE", KEYS[1],ARGV[2])
	else
		return 0
	end
	`
)
